import axios from "axios";

const baseUrl = 'http://localhost:3000'

export const addItem = async (obj)=>{
    let res = await axios.post(`${baseUrl}/books`,obj)
    return res.data
}

export const delBook = async (id)=>{
    let res = await axios.delete(`${baseUrl}/${id}`)
    return res.data
}
export const editItem = async (id,obj)=>{
    let res = await axios.put(`${baseUrl}/books/${id}`,obj)
    return res.data

}
export const getAll = async()=>{
    let res = await axios.get(`${baseUrl}/books`)
    return res.data
}
export const getById = async(id)=>{

    let res = await axios.get(`${baseUrl}/books/${id}`)
    return res.data
}